<template>
  <header class="flex-center">
    <img src="@/assets/images/header-logo.png" alt="">
  </header>
  <section class="section-1 flex-center">
    <div class="inner">
      <p class="title">三分钟解决您的论文问题</p>
      <div class="href-wrap flex-center">
        <span>请在</span>
        <img src="@/assets/images/pc-text.png" alt="">
        <span>体验</span>
      </div>
      <p class="href-text">https://threeminspaper.com/</p>
      <CopyBtn />
    </div>
  </section>
  <section class="section-search flex-center t23">
    <div class="inner-box">
      <img class="header-img" src="@/assets/images/search-header.png" alt="">
      <van-swipe ref="swipeRef" :loop="false" :show-indicators="false" width="277" @change="handleSwipeChange">
        <van-swipe-item>
          <img class="swipe-item-img" src="@/assets/images/search-img.png" alt="">
        </van-swipe-item>
        <van-swipe-item>
          <img class="swipe-item-img" src="@/assets/images/help-img.png" alt="">
        </van-swipe-item>
      </van-swipe>
      <div class="switch-wrap flex-center">
        <div
          v-for="(item, index) of switchItems"
          :key="index"
          class="switch-item"
          :class="{ active: activeIndex == index }"
          @click="handleSwitchItemClick(index)"
        >
          <div class="img-box flex-center">
            <img v-show="activeIndex != index" :src="item.icon" alt="">
            <img v-show="activeIndex == index" :src="item.iconActive" alt="">
          </div>
          <span class="text">{{ item.text }}</span>
        </div>
      </div>
    </div>
  </section>
  <section class="paper-read t23" />
  <section class="paper-writing t23" />
  <section class="user-feedback t23" />
  <section class="href-box flex-center t23">
    <div class="inner">
      <div class="href-wrap flex-center">
        <span>请在</span>
        <img src="@/assets/images/pc-text.png" alt="">
        <span>体验</span>
      </div>
      <p class="href-text">https://threeminspaper.com/</p>
      <CopyBtn />
    </div>
  </section>
  <footer class="flex-center">
    <div class="inner-box">
      <img class="logo-img" src="@/assets/images/footer-logo.png" alt="">
      <img class="barcode-img" src="@/assets/images/barcode.png" alt="">
      <p class="barcode-text">长按扫码添加公众号</p>
      <div class="footer-text">
        <p>©2024 Threemins paper</p>
        <p class="ba-wrap">
          <a href="https://beian.cac.gov.cn/" target="_blank">网信算备110108652800801240019号</a>
          <a href="https://beian.miit.gov.cn/" target="_blank">京ICP备2023019483号-3</a>
        </p>
      </div>
    </div>
  </footer>
</template>

<script>
export default { name: 'Home' }
</script>

<script setup>
import { ref } from 'vue'
import CopyBtn from '@/components/common/CopyBtn'

const activeIndex = ref(0)
const swipeRef = ref(null)
const switchItems = [
  {
    icon: require('@/assets/images/search.png'),
    iconActive: require('@/assets/images/search-active.png'),
    text: '文献检索'
  },
  {
    icon: require('@/assets/images/help.png'),
    iconActive: require('@/assets/images/help-active.png'),
    text: '学术助手'
  }
]

const handleSwitchItemClick = (index) => {
  activeIndex.value = index
  swipeRef.value.swipeTo(index)
}

const handleSwipeChange = (index) => {
  activeIndex.value = index
}
</script>

<style lang="scss" scoped>
header {
  box-sizing: border-box;
  height: 140px;
  border-bottom: 1px solid #ececec;

  img {
    height: 48px;
  }
}
.section-1 {
  height: 759px;
  background: url('~@/assets/images/section1-bg.png') no-repeat;
  background-size: 100% 100%;
}

.t23 {
  position: relative;
  top: -23px;
}

.section-search {
  box-sizing: border-box;
  width: 750px;
  height: 891px;
  padding: 100px 16px 100px 16px;
  border-radius: 32px;
  background: #262c2c;

  .inner-box {
    width: 718px;
    .header-img {
      height: 120px;
    }

    .van-swipe {
      margin-top: 64px;
      .swipe-item-img {
        width: 530px;
      }
    }
    .switch-wrap {
      margin-top: 48px;
      .switch-item {
        display: flex;
        align-items: center;
        font-size: 32px;
        font-weight: 500;
        line-height: 44.8px;
        color: #7d8080;

        .img-box {
          position: relative;
          right: -5px;
          width: 60px;
          height: 60px;
          background-color: transparent;
          img {
            width: 31px;
          }
        }
        .text {
          position: relative;
          z-index: 2;
        }

        &:first-child {
          margin-right: 80px;
          &.active {
            color: #fff;
            .img-box:first-child {
              background-color: #04b17e;
              border-radius: 50%;
            }
          }
        }
        &:last-child {
          &.active {
            color: #fff;
            .img-box:first-child {
              background-color: #5970f1;
              transform: skew(-20deg);
            }
          }
        }
      }
    }
  }
}

.paper-read {
  height: 1578px;
  background: url('~@/assets/images/paper-read-bg.png') no-repeat;
  background-size: 100% 100%;
}

.paper-writing {
  height: 2900px;
  background: url('~@/assets/images/paper-writing-bg.png') no-repeat;
  background-size: 100% 100%;
}

.user-feedback {
  height: 1552px;
  background: #f2f2f2;
  background-image: url('~@/assets/images/user-bg.png');
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.href-box {
  height: 410px;
  background: url('~@/assets/images/section1-bg.png') no-repeat;
  background-size: 100% 100%;
}

.inner {
  width: 560px;
  color: #000000e0;

  .title {
    font-size: 80px;
    font-weight: 600;
    line-height: 120px;
    text-align: center;
  }
  .href-wrap {
    margin-top: 56px;
    font-size: 32px;
    font-weight: 600;
    line-height: 32px;
    text-align: center;

    align-items: flex-end !important;

    img {
      position: relative;
      top: 4px;
      height: 52px;
      margin: 0 5px;
    }
  }
  .href-text {
    margin-top: 16px;
    font-size: 28px;
    line-height: 39.2px;
    text-align: center;
    color: #00000073;
  }

  .copy-wrap {
    margin: 0 auto;
    margin-top: 40px;
  }
}

footer {
  box-sizing: border-box;
  width: 750px;
  height: 664px;
  padding: 100px 30px 56px 30px;
  border-radius: 32px 32px 0px 0px;
  background: #262c2c;

  .inner-box {
    display: flex;
    flex-direction: column;
    align-items: center;

    width: 690px;
    height: 508px;

    .logo-img {
      height: 48px;
    }
    .barcode-img {
      margin-top: 56px;
      height: 200px;
    }
    .barcode-text {
      margin-top: 24px;
      font-size: 28px;
      line-height: 44px;
      color: #fff;
    }

    .footer-text {
      margin-top: 56px;
      text-align: center;
      font-size: 24px;
      font-weight: 400;
      line-height: 33.6px;
      color: #7d8080;

      .ba-wrap {
        margin-top: 12px;
      }
    }
  }
}
</style>
